﻿<ResourceDictionary x:Class="PropertyGridDictionary" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xml:lang="fr-FR"
    xmlns:local="clr-namespace:OMANE.Modules.Dashboarding">

    <Color x:Key="testcol" A="128" R="20" B="200" G="100" />


    <DataTemplate x:Key="DefaultCellTemplate">
        <TextBlock Text="{Binding Value}" />
    </DataTemplate>

    <DataTemplate x:Key="ObjectCellEditingTemplate">
        <!---->
        <Button Focusable="False" Content="Cliquer Pour Editer" Command="{Binding EditCommand}" Background="White"  />
    </DataTemplate>

    <DataTemplate x:Key="StringFormatCellEditingTemplate">
        <Grid>
            <Grid.ColumnDefinitions >
                <ColumnDefinition />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBox Text="{Binding Path=Value, Mode=TwoWay}" />
            <Button Focusable="False" Margin="1" Padding="5,0,5,0" Content=" ... " Click="StringFormatCellEditingTemplateButtonClick" Background="White" Grid.Column="1"  />
        </Grid>
    </DataTemplate>


    <DataTemplate x:Key="BrushCellTemplate">
        <Rectangle Fill="{Binding Value}" />
    </DataTemplate>

    <DataTemplate x:Key="StringCellEditingTemplate">
        <TextBox Text="{Binding Path=Value, Mode=TwoWay}" />
    </DataTemplate>

    <DataTemplate x:Key="NumericCellEditingTemplate">
        <TextBox Text="{Binding Path=Value, Mode=TwoWay}" />
    </DataTemplate>

    <DataTemplate x:Key="EnumCellEditingTemplate">
        <ComboBox  SelectedItem="{Binding Path=Value, Mode=TwoWay}" ItemsSource="{Binding PossibleValues}" />
    </DataTemplate>

    <DataTemplate x:Key="DateCellEditingTemplate">
        <TextBox Text="{Binding Path=Value, Mode=TwoWay}" />
    </DataTemplate>

    <DataTemplate x:Key="BooleanCellEditingTemplate">
        <ComboBox  SelectedItem="{Binding Path=Value, Mode=TwoWay}" ItemsSource="{Binding PossibleValues}" />
    </DataTemplate>

    <DataTemplate x:Key="BrushCellEditingTemplate">
        <ComboBox  SelectedItem="{Binding Path=Value, Mode=TwoWay}" ItemsSource="{Binding PossibleValues}" >
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <Rectangle MinWidth="20" MinHeight="20" Margin="2" Fill="{Binding}" />
                </DataTemplate>
            </ComboBox.ItemTemplate>
            <ComboBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <UniformGrid />
                </ItemsPanelTemplate>
            </ComboBox.ItemsPanel>
        </ComboBox>
    </DataTemplate>
    <DataTemplate x:Key="FontFamilyCellEditingTemplate">
        <ComboBox  SelectedItem="{Binding Path=Value, Mode=TwoWay}" ItemsSource="{Binding PossibleValues}" />
    </DataTemplate>

    <DataTemplate x:Key="FontWeightCellEditingTemplate">
        <ComboBox  SelectedItem="{Binding Path=Value, Mode=TwoWay}" ItemsSource="{Binding PossibleValues}" />
    </DataTemplate>

    <DataTemplate x:Key="DashStyleCellEditingTemplate">
        <ComboBox  SelectedItem="{Binding Path=Value, Mode=TwoWay}" ItemsSource="{Binding PossibleValues}" HorizontalContentAlignment="Stretch" >

        </ComboBox>
    </DataTemplate>

    <DataTemplate x:Key="FontStyleCellEditingTemplate">
        <ComboBox  SelectedItem="{Binding Path=Value, Mode=TwoWay}" ItemsSource="{Binding PossibleValues}" />
    </DataTemplate>

    <local:DashboardZonePropertyThicknessConverter x:Key="DashboardZonePropertyThicknessConverter" />
    <DataTemplate x:Key="ThicknessCellEditingTemplate">
       <!--<UniformGrid Columns="4" Rows="2">
             <TextBox Text="{Binding ConverterParameter=All, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource DashboardZonePropertyThicknessConverter}}" />
             <TextBox Text="{Binding ConverterParameter=All,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource DashboardZonePropertyThicknessConverter}}" />
             <TextBox Text="{Binding Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource DashboardZonePropertyThicknessConverter}}" />
             <Rectangle />
             <TextBox Text="{Binding Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource DashboardZonePropertyThicknessConverter}}" />
             <TextBox Text="{Binding Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource DashboardZonePropertyThicknessConverter}}" />
             <TextBox Text="{Binding Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource DashboardZonePropertyThicknessConverter}}" />
             <TextBox Text="{Binding Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource DashboardZonePropertyThicknessConverter}}" />
        </UniformGrid>-->
        <TextBox Text="{Binding Path=Value, Mode=TwoWay}" />
    </DataTemplate>

    <DataTemplate x:Key="CornerRadiusCellEditingTemplate">
             <TextBox Text="{Binding Path=Value, Mode=TwoWay}" />
    </DataTemplate>
    
    <DataTemplate x:Key="StyleCellEditingTemplate">
          <Button Focusable="False" Content="Cliquer Pour Editer" Click="StyleCellEditingTemplateButtonClick" Background="White"  />
    </DataTemplate>

    <local:DoubleToBooleanConverter x:Key="DoubleToBooleanConverter" />
    <Style TargetType="ListBoxItem"  x:Key="FilterListBoxItemStyle">
        <!--<Setter Property="IsSelected" Value="{Binding Path=IsSelected, Mode=TwoWay, Converter={StaticResource DoubleToBooleanConverter}}" />-->
        <!--<EventSetter Event="MouseLeftButtonUp" Handler="FilterListBoxItemStyleMouseLeftButtonUp" />-->
        <!--<Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem" >
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>-->
        <!--<CheckBox Margin="1" IsChecked="{Binding Path=IsSelected, Mode=TwoWay, Converter={StaticResource DoubleToBooleanConverter}}" IsThreeState="False" />-->
        <!--<TextBlock HorizontalAlignment="Left" Margin="5,0,0,0" VerticalAlignment="Center"  Text="{Binding Path=Member, Mode=OneWay}" Grid.Column="1"/>-->

        <!--<TextBlock Visibility="Visible"  VerticalAlignment="Center" Text="{Binding Path=Count}" Grid.Column="2"/>-->
        <!--<TextBlock Visibility="Visible"  VerticalAlignment="Center"  Grid.Column="2">               
                            <TextBlock.Inlines>
                                <Run Text="{Binding Path=IsSelected, Mode=OneWay}"  />
                                <Run Text=";" />
                                <Run Text="{Binding Path=Count, Mode=OneWay}" />                                
                            </TextBlock.Inlines>
                        </TextBlock>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>-->
        <Setter Property="local:Extender.CornerRadius" Value="0" />
        <!--<Setter Property="IsEnabled" Value="{Binding Count, FallbackValue=true}" />-->
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListBoxItem">
                    <Border BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Background="{TemplateBinding Background}"
                            CornerRadius="{TemplateBinding local:Extender.CornerRadius}"
                            Padding="{TemplateBinding Padding}" 
                            SnapsToDevicePixels="true">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <!--<ColumnDefinition Width="Auto" />-->
                                <ColumnDefinition />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <ContentPresenter 
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            <TextBlock Visibility="Visible" VerticalAlignment="Center" Text="{Binding Path=Count, Mode=OneWay}" Grid.Column="2"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <!--<Trigger Property="IsSelected" Value="true">
                <Setter Property="Style" Value="{Binding RelativeSource={RelativeSource AncestorType=local:SimpleListBox}, Path=SelectedStyle}" />
            </Trigger>-->
        <Trigger Property="IsSelected" Value="true">
								<Setter Property="Background"  Value="Blue"/>
								<Setter Property="Foreground" Value="White"/>
							</Trigger>
        </Style.Triggers>
        </Style>

        <DataTemplate  x:Key="FilterListBoxItemTemplate">
            <!--<Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>-->
                <!--<CheckBox Margin="1" IsChecked="{Binding Path=IsSelected, Mode=TwoWay, Converter={StaticResource DoubleToBooleanConverter}}" IsThreeState="True"  />-->
            <TextBlock HorizontalAlignment="Left" Margin="5,0,0,0" VerticalAlignment="Center"  Text="{Binding Path=Member, Mode=OneWay}" />
            <!--Grid.Column="1"/>-->
                <!--<TextBlock Visibility="Visible" VerticalAlignment="Center" Text="{Binding Path=Count, Mode=OneWay}" Grid.Column="2"/>-->
            <!--</Grid>-->
        </DataTemplate>
</ResourceDictionary>
